from typing import List
from pydantic import BaseModel

class data_x_y(BaseModel):
    x_data:list
    y_data:list
    year:int

class save_data(BaseModel):
    add: list = [{"DvpUnit_OilStim_PlanProj_Name": "str", "DvpUnit_Name": 'str',
                  "Year": 'str', "StimType_Name": 'str',
                  "Stim_WellNumber_Valid": 'int', "Stim_WellValidRatio": "int",
                  "Stim_ValidPeriod_Average": "int", "Stim_IncreOil_Average": 'float'}]
    delete: list = [{"DvpUnit_OilStim_PlanProj_Name": "str", "DvpUnit_Name": 'str',
                     "Year": 'str', "StimType_Name": 'str'}]
    modify: list = [{"DvpUnit_OilStim_PlanProj_Name": "str", "DvpUnit_Name": 'str',
                     "Year": 'str', "StimType_Name": 'str',
                     "Stim_WellNumber_Valid": 'int', "Stim_WellValidRatio": "int",
                     "Stim_ValidPeriod_Average": "int", "Stim_IncreOil_Average": 'float'}]


class select(BaseModel):
    d_name: str
    type_: str
    start_year: str
    end_year: str


class save_BP_data(BaseModel):
    data: list = [{
        "Model_Name": "str",
        "Well_Name": "str",
        "StimType_Name": "str",
        "End_Date": "str",
        "Term_validity": 0,
        "Total_IncreaseOil": 0.0,
        "Sample_Sign": "str",
        "parse_Data": {}
    }]


class delete_BP_data(BaseModel):
    Well_Name: str
    End_Date: str


class read_BP_data(BaseModel):
    Unit_Name: list = ['str']
    Model_Name: str
    Start_Date: str
    End_Date: str


class read_BP_model(BaseModel):
    Model_Name: str


class creat_new_model(BaseModel):
    Model_Name: str
    Creater_Name: str
    StimType_Name: str
    Remark: str



class train_Data_BP(BaseModel):
    Model_Name: str
    BPparalist: list
    params: list


class save_BP_paras(BaseModel):
    Model_Name: str
    DvpUnit_ID: str
    DvpUnit_Name: str
    Stimulate_Date: str
    Sample_Num: int
    Train_Num: int
    Test_Num: int
    Input_Para: str
    HideLayer_CoreNum: int
    HideLayer_Active: str
    OutputLayer_Active: str
    Learn_Rate: float
    Target_error: float
    MaxEpoch: int
    Model_Paras: str
    Compared_Result: str
    Real_Epoch: int
    Epoch_Error: float
    Epoch_Duration: float
    Absolute_ErrorValidity: float
    Relative_Error_Validity: float
    Cum_OilIncreAbsoluteError: float
    Cum_OilIncreRelativeError: float

class ModelInfo(BaseModel):
    Model_Name: str
    StimType_Name: str
    Effect_Paramters_Number: int
    X1_Paramters_Name: str
    X2_Paramters_Name: str
    X3_Paramters_Name: str
    X4_Paramters_Name: str
    X5_Paramters_Name: str
    X6_Paramters_Name: str
    X7_Paramters_Name: str
    X8_Paramters_Name: str
    X9_Paramters_Name: str
    X10_Paramters_Name: str
    X11_Paramters_Name: str
    X12_Paramters_Name: str
    X13_Paramters_Name: str
    X14_Paramters_Name: str
    X15_Paramters_Name: str
    X16_Paramters_Name: str
    X17_Paramters_Name: str
    X18_Paramters_Name: str
    X19_Paramters_Name: str
    X20_Paramters_Name: str
    X21_Paramters_Name: str
    X22_Paramters_Name: str
    X23_Paramters_Name: str
    X24_Paramters_Name: str
    X25_Paramters_Name: str
    X26_Paramters_Name: str
    X27_Paramters_Name: str
    X28_Paramters_Name: str
    X29_Paramters_Name: str
    X30_Paramters_Name: str
    X1_Paramters_Unit: str
    X2_Paramters_Unit: str
    X3_Paramters_Unit: str
    X4_Paramters_Unit: str
    X5_Paramters_Unit: str
    X6_Paramters_Unit: str
    X7_Paramters_Unit: str
    X8_Paramters_Unit: str
    X9_Paramters_Unit: str
    X10_Paramters_Unit: str
    X11_Paramters_Unit: str
    X12_Paramters_Unit: str
    X13_Paramters_Unit: str
    X14_Paramters_Unit: str
    X15_Paramters_Unit: str
    X16_Paramters_Unit: str
    X17_Paramters_Unit: str
    X18_Paramters_Unit: str
    X19_Paramters_Unit: str
    X20_Paramters_Unit: str
    X21_Paramters_Unit: str
    X22_Paramters_Unit: str
    X23_Paramters_Unit: str
    X24_Paramters_Unit: str
    X25_Paramters_Unit: str
    X26_Paramters_Unit: str
    X27_Paramters_Unit: str
    X28_Paramters_Unit: str
    X29_Paramters_Unit: str
    X30_Paramters_Unit: str
    Remark: str
    



class predictData_readData(BaseModel):
    planName: list = ['']
    unitName: list = ['']
    startYear: str
    EndYear: str


class predictData_Modal(BaseModel):
    modelname: str
    data: list = [{
        "DvpUnit_OilStim_PlanProj_Name": "",
        "Well_Name": "",
        "Year": "",
        "parse_Data": {}
    }]



from typing import Optional, List
class SubPredictDataModel(BaseModel):
    DvpUnit_OilStim_PlanProj_Name: str
    Well_Name: str
    Year: str
    X1: Optional[float]
    X2: Optional[float]
    X3: Optional[float]
    X4: Optional[float]
    X5: Optional[float]
    X6: Optional[float]
    X7: Optional[float]
    X8: Optional[float]
    X9: Optional[float]
    X10: Optional[float]
    X11: Optional[float]
    X12: Optional[float]
    X13: Optional[float]
    X14: Optional[float]
    X15: Optional[float]
    X16: Optional[float]
    X17: Optional[float]
    X18: Optional[float]
    X19: Optional[float]
    X20: Optional[float]
    X21: Optional[float]
    X22: Optional[float]
    X23: Optional[float]
    X24: Optional[float]
    X25: Optional[float]
    X26: Optional[float]
    X27: Optional[float]
    X28: Optional[float]
    X29: Optional[float]
    X30: Optional[float]

class predictData_savedata(BaseModel):
    data: list = [{
        "DvpUnit_OilStim_PlanProj_Name": "",
        "Well_Name": "",
        "Year": "",
        "parse_Data": {},
        "ValidPeriod_Forecast": "",
        "IncreOil_Forecast": "",
        "BP_Model_Name": "",
        "Stim_Frac_Forecast_Date": ""
    }]


class predictData_savetopredtabel(BaseModel):
    data: list = [{
        "DvpUnit_OilStim_PlanProj_Name": "",
        "Well_Name": "",
        "Year": "",
        "Model_Name": "",
        "Stim_ValidPeriod": "",
        "Stim_IncreOil": "",
    }]

class predictData_save_params(BaseModel):
    add: list = [{
        "DvpUnit_OilStim_PlanProj_Name": "",
        "Well_Name": "",
        "Year": "",
        "parse_Data": {}
    }]
    delete:list = ['']

class page_recovery_data_read(BaseModel):
    userid: str
    projid: str

class page_recovery_data_save(BaseModel):
    userid: str
    projid: str
    tab1:str
    tab2:str
    tab3:str